<template>
    <div>
        <!--https证书绑定 /v1/site/index/bind-ssl  -->
        <div  v-if="selected===0">
            <div class="toop">
                <span class="h3" slot="header">https证书绑定 - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <div class="content-left">
                    <Form :label-width='130' :ref='modalres' :model='modalparams' class="setmodal" label-position="top">
                        <div class="ivu-mt-8 ivu-mb-16" style="display: flex;">
                        <template>
                            <Upload 
                            :action="requestAction"
                            :headers="{'Authorization': 'Bearer ' + token,'projectid':project}"
                            :format="['zip']"
                            :before-upload="handleBeforeUpload"  
                            :on-error="errorImgFile"
                            :on-success="successUpload" 
                            :show-upload-list="false"
                            >
                                <Button type="primary" icon="ios-cloud-upload-outline">上传证书文件</Button>
                            </Upload>
                        </template>
                        <p class="ivu-mt-8 ivu-ml-16" style="color:#f00">可直接上传从阿里云下载的zip证书压缩包</p>
                        </div>
                        <div class="formCont" v-if="modalparams.ssl_end_date">
                            <div>
                                <div>已部署成功:请在证书到期之前更换新的证书</div>
                                <div>认证域名：{{modalparams.certificate}}</div>
                            </div>
                            <div>
                                <div>证书品牌：{{modalparams.brand}}</div>
                                <div>到期时间：{{modalparams.ssl_end_date}}</div>
                            </div>
                        </div>
                        <div class="textarea">
                            <div class="keyf">
                                <span style="font-size:14px,margin-bottom:10px">密钥(KEY)</span>
                                <Input class="inputclass" v-model="modalparams.ssl_key_data" type="textarea" :autosize="{ minRows: 10, maxRows: 18 }" placeholder="请输入密钥(KEY)" />
                            </div>
                            <div>
                                <span  style="font-size:14px,margin-bottom:10px">证书(PEM格式)</span>
                                <Input class="inputclass" v-model="modalparams.ssl_pem_data" type="textarea" :autosize="{ minRows: 10, maxRows: 18 }" placeholder="请输入证书(PEM格式)" @on-blur="changeBlur()" />
                            </div>
                        </div>
                    </Form>
                    <div slot='footer' style="margin-top:15px">
                        <!-- <Button @click='canceledit(modalname)'>取消</Button> -->
                        <Button  type='primary' :loading="bindloading" @click='saveBinds(modalname)' style="margin-right:10px">保存</Button>
                        <Button  type='primary'  @click='closeSsl(modalname)'>关闭SSL</Button>
                    </div>
                </div>
                <div >
                    <div class="rignt-box">
                        <p>粘贴您的*.key以及*.pem内容，然后保存即可<b style="color:#f59a23">（切勿手动编辑修改）</b></p>
                        <p>如果浏览器提示证书链不完整,请检查是否正确拼接PEM证书</p>
                        <p>PEM格式证书 = 域名证书.crt + 根证书(root_bundle).crt</p>
                        <p>在未指定SSL默认站点时,未开启SSL的站点使用HTTPS会直接访问到已开启SSL的站点</p>
                        <p>如开启后无法使用HTTPS访问，请检查安全组是否正确放行443端口</p>
                    </div>
                </div>
            </div>
        </div>
        <!-- 绑定专题 /v1/site/index/bind-zt -->
        <div v-if="selected===1" >
            <div class="toop">
                <span class="h3" slot="header">绑定专题： - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <div class="content-left">
                    <Form :label-width='86' :ref='modalname' :model='modalparams' class="setmodal">
                        <FormItem label='网站域名：'>
                            <p>{{modalparams.domain}}</p>
                        </FormItem>
                        <FormItem label='绑定专题：'>
                            <span>{{modalparams.zt_dir==0?'':modalparams.zt_dir}}</span>
                            <Button v-if="modalparams.zt_dir" class="ivu-ml-16" type='primary'  @click='changeZtdir()'>取消绑定</Button>
                        </FormItem>
                        <div class="radioStyle">
                            <RadioGroup v-model="modalparams.zt_dir">
                                <Radio :label="item" v-for="(item, index) of modalparams.zt_dir_list" :key="index"></Radio>
                            </RadioGroup>
                        </div>
                    </Form>
                    <div slot='footer'>
                        <!-- <Button @click='canceledit(modalname)'>取消</Button> -->
                        <Button  type='primary' :loading="subloading" @click='savePrject(modalname)'>保存</Button>

                    </div>
                </div>
                <div class="content-rignt">
                    <div class="rignt-box">
                        <h3>使用说明：</h3>
                        <h4>绑定专题：</h4>
                        <p> 专题为项目通用；同一个项目下所有域名对应的绑定专题目录是共用的。专题目录从服务端获取。</p>
                        <h4>举个栗子：</h4>
                        <p>北大项目，默认专题路径为：/data/wwwroot/bd.jgyljt.com/zt/</p>
                        <p>如www.65650000.com当前站点设定绑定专题yhpc，则会将当前项目默认zt下yhpc目录软链接到当前站点目录/zt/下面。
                            ln -s /data/wwwroot/bd.jgyljt.com/zt/yhpc /data/wwwroot/website/www.65650000.com/zt</p>
                    </div>
                </div>
            </div>
        </div >
        <!--绑定二级栏目 /v1/site/index/bind-zt -->
        <div v-if="selected===2" >
            <div class="toop">
                <span class="h3" slot="header">绑定二级栏目： - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <Form :label-width='60' :ref='columnData' :model='modalparams' class="setmodal">
                    <FormItem label='域名：' >
                        <Input style="width: 280px" v-model="modalparams.zt_other_domain" placeholder="请输入域名" />
                    </FormItem>
                    <FormItem label='栏目：' >
                        <Input style="width: 280px" v-model="modalparams.zt_other_dir" placeholder="请输入栏目" />
                    </FormItem>
                </Form>
                <div slot='footer' style="margin-top:15px">
                    <!-- <Button @click='canceledit(modalname)'>取消</Button> -->
                    <Button  type='primary'  :loading="bztloading" @click='saveBzt(columnData)'>保存</Button>
                </div>
            </div>
            <div class="content-rignt">
                <div class="rignt-box">
                    <p style="color:#f59a23">绑定二级栏目和301跳转，不可同时设置。</p>
                    <h4>举个栗子：</h4>
                    <p> 网址www.baidu.com, 绑定二级栏目域名：www.6500.com，栏目：test</p>
                    <p>实现的效果：访问www.6500.com/test，展现的将是www.baidu.com的页面内容</p>
                </div>
            </div>
        </div>
        <!-- 301配置 /v1/site/index/bind-redirect -->
        <div  v-if="selected===3">
            <!-- <div class="toop">
              <span class="h3" slot="header">301配置： - {{modalparams.domain}}</span>
            </div> -->
            <Tabs type="card" class="ivu-mt-16">
                <TabPane label="301到当前域名">
                    <div class="content">
                        <Form :label-width='140' :ref='sitename' :model='modalparams' class="setmodal">
                            <FormItem  label='需要配置的域名：'>
                                <Input @on-blur="textareaBlur" type="textarea" :autosize="{ minRows: 5, maxRows: 6 }" style="width: 280px" clearable v-model='modalparams.redirect_301_to_site' placeholder='1行1个域名，请提前将需要配置的域名解析到正确的服务器' />
                            </FormItem>
                            <FormItem label='301跳转到：'>
                                <p>{{modalparams.domain}}</p>
                            </FormItem>
                        </Form>
                    </div>
                    <div >
                        <Button  type='primary'  :loading="siteloading" @click='bindredirectSite(sitename)'>保存</Button>
                    </div>
                    <div class="content-rignt">
                        <div class="rignt-box">
                            <p style="color:#000">使用说明：</p>
                            <p>允许同时配置多个域名301跳转到当前站点；</p>
                            <p>配置的域名需要提前解析到当前301跳转的域名所在服务器；</p>
                            <p>配置的域名，可以不需要在当前网站管理系统里面建站</p>
                        </div>
                    </div>
                </TabPane>
                <TabPane label="301到其他域名">
                    <div class="content">
                        <Form :label-width='90' :ref='paramsname' :model='modalparams' class="setmodal">
                            <FormItem label='当前域名：'>
                                <p>{{modalparams.domain}}</p>
                            </FormItem>
                            <FormItem label='301跳转：'>
                                <Input style="width: 280px" v-model="modalparams.redirect_301" placeholder="请输入301跳转地址" />
                            </FormItem>
                        </Form>
                    </div>
                    <div >
                        <Button  type='primary'  :loading="rectloading" @click='saveRect(paramsname)'>保存</Button>
                    </div>
                    <div class="content-rignt">
                        <div class="rignt-box">
                            <p style="color:#f59a23">绑定二级栏目和301跳转，不可同时设置。</p>
                            <p> 301跳转的地址，必须是代有协议头的完整的URL，比如：http://www.65000.com</p>
                        </div>
                    </div>
                </TabPane>

            </Tabs>
        </div>
        <!-- 遮罩配置 /v1/site/index/set-zz -->
        <div v-if="selected===4" >
            <div class="toop">
                <span class="h3" slot="header">遮罩配置： - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <Form :label-width='90' :ref='modalForm' :model='modalparams' class="setmodal">
                    <FormItem label='网站域名：'>
                        <p>{{modalparams.domain}}</p>
                    </FormItem>
                    <FormItem label='遮罩跳转：'>
                        <Input style="width: 280px" v-model="modalparams.zz_url" placeholder="请输入遮罩跳转地址" />
                    </FormItem>
                </Form>
            </div>
            <div slot='footer'>
                <Button  type='primary'  :loading="modalloading" @click='saveModal(modalForm)'>保存</Button>
            </div>
            <div class="content-rignt">
                <div class="rignt-box">
                    <p >遮罩配置，是为了实现搜索引擎爬虫访问和用户访问同一网址，显示不同页面效果。</p>
                    <p> 设置遮罩地址后，搜索引擎爬虫访问时，会正常访问当前站点页面；当用户访问时，则会呈现遮罩地址内容。</p>
                    <p><font style="color:#f59a23">遮罩地址，支持的输入格式：   </font>/zt/youhuanewyiyuan/    或   3g.120yy.com/zt/youhuanewyiyuan/</p>
                    <p>一般遮罩填写的都是当前站点或其它站点的某个专题，请严格按照支持的格式填写，不可带协议头http://。</p>
                </div>
            </div>
        </div>
        <!-- 首页跳转配置 /v1/site/index/set-index-location -->
        <div v-if="selected===5">
            <div class="toop">
                <span class="h3" slot="header">首页跳转配置： - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <Form :label-width='120' :ref='returnForm' :model='modalparams' class="setmodal">
                    <FormItem label='网站域名：'>
                        <p>{{modalparams.domain}}</p>
                    </FormItem>
                    <FormItem label='当前站点类型：'>
                        <p>{{modalparams.site_type==1?'PC站点':modalparams.site_type==2?'手机站点':''}}</p>
                    </FormItem>
                    <FormItem label='跳转站点类型：'>
                        <Select style="width:280px" v-model="modalparams.location_type"  placeholder="请选择跳转站点类型" clearable @on-change="changeclear">
                            <Option v-for="item in typeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label='跳转地址：'>
                        <Input style="width: 280px" v-model="modalparams.location_url" placeholder="请输入访问时跳转地址" />
                    </FormItem>
                </Form>
            </div>
            <div slot='footer'>
                <Button  type='primary'  :loading="modalloading" @click='saveLink(returnForm)'>保存</Button>
            </div>
            <div class="content-rignt">
                <div class="rignt-box">
                    <p style="color:#f59a23">实现效果：在当前网址不变的前提下，实现A站点用电脑打开和手机打开，显示不同的页面内容 （当前只支持首页跳转，不支持二级栏目跳转）</p>
                    <p> # 跳转当前站点其它目录，正确写法参考：hypdf    （直接填写目录名称即可，必须确保目录存在）</p>
                    <p># 跳转到当前项目其它网址，正确写法参考：www.baidu.com （直接填写网址域名即可）</p>
                    <p  style="color:#f59a23">跳转地址所配置的网址必须跟当前域名在同一台服务器！</p>
                    <p  style="color:#f59a23">不支持跨服务器跳转配置！</p>
                </div>
            </div>
        </div>
        <!-- 百度站长收录配置 /v1/site/index/set-yh -->
        <div v-if="selected===6">
            <div class="toop">
                <span class="h3" slot="header">百度站长收录配置： - {{modalparams.domain}}</span>
            </div>
            <div class="content">
                <Form :label-width='140' :ref='tokForm' :model='modalparams' class="setmodal">
                    <FormItem label='快速收录配置token:'>
                        <Input style="width: 280px" v-model="modalparams.yh_fast_token" placeholder="请输入百度的token" />
                    </FormItem>
                    <FormItem label='普通收录配置token:'>
                        <Input style="width: 280px" v-model="modalparams.yh_general_token" placeholder="请输入百度的token" />
                    </FormItem>
                </Form>
            </div>
            <div slot='footer' >
                <Button  type='primary'  :loading="tokenloading" @click='saveToken(tokForm)'>保存</Button>
            </div>
            <div class="content-rignt">
                <div class="rignt-box">
                    <p style="color:#f59a23">此处收录配置，为百度站长收录配置信息。</p>
                    <p> 快速收录：部分站点会有，1天最多10条</p>
                    <p>普通收录：根据站点不同，条数不同。</p>
                </div>
            </div>
        </div>
        <!-- 配置文件  /v1/site/index/update-nginx-config-->
        <div v-if="selected===7">
            <div style="width:810px">
                <Tabs :value="name" @on-click="changetabs">
                    <TabPane label="Nginx配置" name="nginx_conf">
                        <template>
                            <div class="home">
                                <div id="nginx_conf" class="style"></div>
                            </div>
                        </template>
                        <div style="margin-top:15px">
                            <Button  type='primary'   @click='saveMonaco()'>保存</Button>
                        </div>
                    </TabPane>
                    <TabPane label="Https配置" name="ssl_conf">
                        <template>
                            <div class="home">
                                <div id="ssl_conf" class="style"></div>
                            </div>
                        </template>
                        <div style="margin-top:15px">
                            <Button  type='primary'   @click='saveMonaco()'>保存</Button>
                        </div>
                    </TabPane>
                    <TabPane label="遮罩配置" name="zz_conf">
                        <template>
                            <div class="home">
                                <div id="zz_conf" class="style"></div>
                            </div>
                        </template>
                        <div style="margin-top:15px">
                            <Button  type='primary'   @click='saveMonaco()'>保存</Button>
                        </div>
                    </TabPane>
                    <TabPane label="301配置" name="301_conf">
                        <template>
                            <div class="home">
                                <div id="301_conf" class="style"></div>
                            </div>
                        </template>
                        <div style="margin-top:15px">
                            <Button  type='primary'   @click='saveMonaco()'>保存</Button>
                        </div>
                    </TabPane>
                    <TabPane label="首页跳转配置" name="index_location_conf">
                        <template>
                            <div class="home">
                                <div id="index_location_conf" class="style"></div>
                            </div>
                        </template>
                        <div style="margin-top:15px">
                            <Button  type='primary'   @click='saveMonaco()'>保存</Button>
                        </div>
                    </TabPane>
                </Tabs>
            </div>
            <div class="content-rignt">
                <div class="rignt-box">
                    <p style="color:#f59a23">此处为站点主配置文件,若您不了解配置规则,请勿随意修改.</p>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { saveBindssl, saveBzt, saveRedirect, saveSet, saveOptimize, configInfo, updateNginx, indexLoction, cancelBindssl, bindsslData, checksslData, sslInfo,bindredirectSite } from '@api/httpsetting'
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
// import MonacoEditor from 'vue-monaco-editor'
import Setting from '@/setting';
import util from '@/libs/util';
export default {
    // components: { template, MonacoEditor },
    props: {
        modalparams: {
            type: Object,
            request: true
        },
        selected: {
            type: Number,
            default: 0
        }
    },
    data () {
        return {
            returnForm: 'returnForm',
            modalForm: 'modalForm',
            paramsname: 'paramsname',
            modalres: 'modalres',
            modalname: 'modalname',
            columnData: 'columnData',
            tokForm: 'tokForm',
            sitename:'sitename',
            modal: false,
            bindloading: false,
            subloading: false,
            bztloading: false,
            rectloading: false,
            modalloading: false,
            tokenloading: false,
            ztdir: false,
            siteloading:false,
            zt_dir_list: [],
            domainlist: [],
            ssl_keyname: '',
            ssl_pemname: '',
            ssl_time: '',
            ssl_edit: false,
            typeList: [
                {
                    value: 1,
                    label: 'PC站点'
                },
                {
                    value: 2,
                    label: '手机站点'
                }
            ],
            editor: null,
            editorData: null,
            name: 'nginx_conf',
            url:Setting.apiBaseURL,
            token: util.cookies.get('token'),
            project: util.storage.get('currentProject'),
            requestAction:''
        }
    },
    mounted () {
        this.requestAction=this.url+`/v1/site/index/get-ssl-zip`
    },
    methods: {
        textareaBlur () {
            let arr = []
            let other_domain= this.modalparams.redirect_301_to_site.toLowerCase()
            arr = other_domain.split('\n')
            const domain = arr.map(item => {
                return item.replace(/https?:\/\//gi, '').replace(/\/.*$/gi, '')
            })
            this.modalparams.redirect_301_to_site = domain.join('\n')
        },
        canceledit () {
            this.modal = false
        },
        // 检验证书是否存在
        changeBlur () {
            if (this.modalparams.ssl_pem_data) {
                let params = {
                    id: this.modalparams.id,
                    ssl_pem_data: this.modalparams.ssl_pem_data
                }
                checksslData(params).then(res => {
                    this.modalparams.certificate = res.domain
                    this.modalparams.brand = res.brand
                    this.modalparams.ssl_end_date = res.ssl_end_date
                })
            }
        },
        // 绑定https
        saveBinds () {
            this.bindloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('ssl_pem_data', this.modalparams.ssl_pem_data)
            FormDatas.append('ssl_key_data', this.modalparams.ssl_key_data)
            bindsslData(FormDatas).then((response) => {
                // console.log(response,'response')
                if(response.code==422){
                    this.$Message.error(response.message)
                }else{
                    this.$Message.success('配置成功')
                    this.$emit('askData')
                  
                }
                this.bindloading = false
            }).catch(() => {
                this.bindloading = false
            })
        },
        // 绑定专题
        savePrject () {
            this.subloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            // FormDatas.append('domain', this.modalparams.domain)
            FormDatas.append('zt_type', 1)
            FormDatas.append('zt_dir', this.modalparams.zt_dir)
            saveBzt(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.subloading = false
            }).catch(() => {
                this.subloading = false
            })
        },
        // 取消绑定
        changeZtdir () {
            this.modalparams.zt_dir = ''
        },
        // 绑定二级栏目
        saveBzt () {
            this.bztloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('zt_type', 2)
            FormDatas.append('zt_other_domain', this.modalparams.zt_other_domain)
            FormDatas.append('zt_other_dir', this.modalparams.zt_other_dir)
            saveBzt(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.bztloading = false
            }).catch(() => {
                this.bztloading = false
            })
        },
        // 301配置
        saveRect () {
            this.rectloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('redirect_301', this.modalparams.redirect_301)
            saveRedirect(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.rectloading = false
            }).catch(() => {
                this.rectloading = false
            })
        },
        //绑定301【跳转到当前站点】
        bindredirectSite(){
            this.siteloading=true
            const redirect_301_to_site=this.modalparams.redirect_301_to_site.split('\n')
            // console.log(redirect_301_to_site,'redirect_301_to_site')
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('redirect_301_domain', redirect_301_to_site.join(','))
            // const FormDatas={
            //   id:this.modalparams.id,
            //   redirect_301_domain:this.modalparams.redirect_301_domain
            // }
            bindredirectSite(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.siteloading = false
            }).catch(() => {
                this.siteloading = false
            })
        },
        // 遮罩配置
        saveModal () {
            this.modalloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('zz_url', this.modalparams.zz_url)
            saveSet(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.modalloading = false
            }).catch(() => {
                this.modalloading = false
            })
        },
        changeclear (val) {
            if (val === undefined) {
                this.modalparams.location_type = ''
            } else {
                this.modalparams.location_type = val
            }
        },
        // 首页跳转配置
        saveLink () {
            this.modalloading = true;
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('location_type', this.modalparams.location_type)
            FormDatas.append('location_url', this.modalparams.location_url)
            indexLoction(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.modalloading = false
            }).catch(() => {
                this.modalloading = false
            })
        },
        // 百度站长收录配置
        saveToken () {
            this.tokenloading = true
            let FormDatas = new FormData()
            FormDatas.append('id', this.modalparams.id)
            FormDatas.append('yh_fast_token', this.modalparams.yh_fast_token)
            FormDatas.append('yh_general_token', this.modalparams.yh_general_token)
            saveOptimize(FormDatas).then(() => {
                this.$Message.success('配置成功')
                this.$emit('askData')
                this.tokenloading = false
            }).catch(() => {
                this.tokenloading = false
            })
        },
        // FormDatas.append('ssl_time', this.modalparams.ssl_time ? this.$Date(this.modalparams.ssl_time).format('YYYY-MM-DD') : '')
        // 关闭
        closeSsl () {
            this.$Modal.confirm({
                title: '确定关闭SSL,将清空已配置内容',
                // content: '<p>Content of dialog</p><p>Content of dialog</p>',
                onOk: () => {
                    cancelBindssl({ id: this.modalparams.id }).then(() => {
                        this.$Message.success('关闭成功')
                        this.modalparams.ssl_key_data = ''
                        this.modalparams.ssl_pem_data = ''
                        this.getHttps()
                    }).catch(() => {

                    })
                },
                onCancel: () => {
                    // this.$Message.info('取xiao');
                }
            });
        },
        // 获取https信息
        getHttps () {
            sslInfo({ id: this.modalparams.id }).then(res => {
                this.modalparams.certificate = res.domain
                this.modalparams.brand = res.brand
                this.modalparams.ssl_end_date = res.ssl_end_date
            })
        },
        changetabs (name) {
            this.name = name
            this.getNginx()
        },
        // 获取配置文件
        getNginx () {
            configInfo({ id: this.modalparams.id, type: this.name }).then((res) => {
                if (this.editor) this.editor.dispose()

                this.editorData = res.conf_data
                this.editor = monaco.editor.create(document.getElementById(this.name), {
                    value: this.editorData,
                    language: 'sql',
                    automaticLayout: true,
                    theme: 'vs-dark',
                    autoFindInSelection: 'always'
                })
                this.editor.getValue(this.editorData)
            })
        },
        // 设置nixi
        saveMonaco () {
            let data = this.editor.getValue();
            let params = {
                id: this.modalparams.id,
                type: this.name,
                nginx_data: data
            }
            updateNginx(params).then((res) => {
                this.$Message.success('设置成功')
            })
        },
        //上传文件
        handleBeforeUpload(file){
                // console.log(file,'file')
                const fileExt = file.name.split('.').pop().toLocaleLowerCase()
				if (fileExt !== 'zip') {
					this.$Notice.warning({
						title: '文件类型错误',
						desc: '文件：' + file.name + '不是Zip文件，请选择后缀为.zip的Zip文件。'
					})
                    return false
				}
			
            },
            successUpload(response, file, fileList){
                // console.log(response,'response')
                if (response.code===422){
                    this.modal=true
                    // this.$Message.error(response.message)
                    this.$Message.error({
                        top: 50,
                        duration: 3,
                        content:response.message
                    });
                //     this.$Modal.confirm(
                //     {
                //         title:'表格错误',
                //         content: `<span>${response.message}</span>`,
                //         onOk:()=> {
                //             deleteIndex({id:row.id}).then(res=>{
                //              this.$Message.success('删除成功')
                //              this.getData()
                //            })
                           
                //         }
                //     }
                // )
                    // this.$Notice.warning({
					// 	title: '表格错误',
					// 	desc: response.message,
                    //     duration: 0
					// })
                }else{
                    this.modalparams.ssl_key_data=response.data.ssl_key_data
                    this.modalparams.ssl_pem_data=response.data.ssl_pem_data
                    this.$Notice.success({
                    title: '提示',
                    desc: '上传成功！',
                    duration: 1
                    })
                    this.changeBlur()
                }
                
			},
			// 上传失败
			errorImgFile(error, file, fileList) {
				this.$Notice.success({
                    title: '提示',
                    desc: '上传失败！'
                })

            },
    }
}
</script>
<style scoped>
.formCont{
    display: flex;
    justify-content:space-around;
    background: #bef1d8;
    border-radius: 5px;
    padding: 5px 0;
    color: #19be6b;
    font-size: 16px;
    margin-bottom: 20px;
}
.formCont div{
    padding: 3px 0;
}
.keyf{
    margin-right: 10px;
}
.inputclass{
    width: 400px;
}
.textarea{
    display: flex;
    justify-content: flex-start;
}
.toop{
    padding:8px 0;
    border-bottom: 1px solid #ccc;
}
.h3{
    padding: 9px 0;
    font-size: 16px;
    font-weight: bolder;
    /* border-bottom: 1px solid #5cadff; */

}
.content{
    padding: 10px 0 0 0;
}
.footer{
    margin-left: 45px;
    margin-top:20px
    /* text-align: center; */
}
.ml-10{
    margin-left: 10px;
}
.rignt-box{
    border: 1px dashed #ccc;
    margin: 20px 0;
    padding: 20px 10px;
    line-height: 30px;
}
.style {
    width: 100%;
    height: 500px;
    border: 1px solid #ebebeb;
    border-radius: 4px;
}
.radioStyle{
    margin:10px 0;
    height: 320px;
    width: 100%;
    border: 1px solid #ccc;
    padding:15px 10px;
    overflow: auto;
}
/deep/.ivu-form-item{
    margin-bottom: 9px;
}
</style>
